<template>
  <div class="ui-dataset-item" :class="['is-label-' + labelPosition]">
    <span class="ui-dataset-item__label" :style="{'width': labelWidth}">
      {{ label }}
    </span>
    <span class="ui-dataset-item__target">
      <slot></slot>
    </span>
  </div>
</template>
<script>
export default {
  name: 'UiDatasetItem',
  inject: ['UiDataset'],
  props: {
    label: {
      type: String
    }
  },
  computed: {
    labelWidth() {
      return this.UiDataset.labelWidth
    },
    labelPosition () {
      return this.UiDataset.labelPosition
    }
  }
}
</script>
<style lang="less">
.ui-dataset-item{
  min-height: 24px;
  line-height: 24px;
  padding-top: 3px;
  padding-bottom: 3px;
  display: flex;
  flex-direction: row;
  &.is-label-left{
    text-align: left;
  }
  &.is-label-right {
    text-align: right;
  }
}
.ui-dataset-item__label{
  color: #999;
  display: inline-block;
  margin-right: 6px;
}
</style>
